package org.jederik.studip.android.provider;

import org.jederik.android.provider.StudIP;
import org.jederik.android.provider.StudIP.*;

import android.content.UriMatcher;

/**
 * Klasse, die zum Aufschlüsseln von den Content-URIs des Studip Content
 * Providers dient.
 * @author Jann-Fredeik Laß
 *
 */
public class StudipUriMatcher extends UriMatcher {

	/** Bezieht sich auf die gesamte Stud.IP-Datenbank */
	public static final int _ALL = 12;

	/** Benachrichtigungen */
	public static final int NOTIFICATIONS = 1;

	/** Liste der Änderungen */
	public static final int FEED = 2;
	
	/** Einzelner Feed-Eintrag zu bestimmter Resource */
	public static final int FEED_ID = 13;
	
	/** Liste aller empfangenen Nachrichten */
	public static final int MESSAGES = 3;

	/** Einzelne Message */
	public static final int MESSAGES_ID = 4;
	
	/** Einzelner News-Eintrag */
	public static final int NEWS_ID = 5;
	
	/** Liste der Stundenplantermine */
	public static final int SCHEDULES = 11;
	
	/** Einzelner Stundenplantermin */
	public static final int SCHEDULES_ID = 6;
	
	/** Liste der Besuchten Veranstaltungen */
	public static final int MYCOURSES = 7;
	
	/** Einzelne Veranstaltung */
	public static final int COURSES_ID = 8;
	
	/** Basisdaten zu einer Veranstaltung */
	public static final int COURSES_ID_DETAILS = 9;
	
	/** Liste der Teilnehmer einer Veranstaltung */
	public static final int COURSES_ID_PARTICIPANTS = 10;
	
	/** Liste der gesendeten Nachrichten */
	public static final int MESSAGES_SENT = 14;
	
	/** Einzelne gesendete Nachricht */
	public static final int MESSAGES_SENT_ID = 15;
    
	
	public StudipUriMatcher() {
		super(UriMatcher.NO_MATCH);
		addURI(StudIP.AUTHORITY, Notifications.CONTENT_TABLE_NAME, NOTIFICATIONS);
        addURI(StudIP.AUTHORITY, Feed.CONTENT_TABLE_NAME, FEED);
        addURI(StudIP.AUTHORITY, Feed.CONTENT_TABLE_NAME + "/*", FEED_ID);
		addURI(StudIP.AUTHORITY, Messages.CONTENT_TABLE_NAME, MESSAGES);
        addURI(StudIP.AUTHORITY, Messages.CONTENT_TABLE_NAME + "/*", MESSAGES_ID);
        addURI(StudIP.AUTHORITY, News.CONTENT_TABLE_NAME + "/*", NEWS_ID);
        addURI(StudIP.AUTHORITY, Schedules.CONTENT_TABLE_NAME + "/*", SCHEDULES_ID);
        addURI(StudIP.AUTHORITY, Courses.CONTENT_TABLE_NAME + "/*", COURSES_ID);
        addURI(StudIP.AUTHORITY, Courses.CONTENT_TABLE_NAME + "/*/" + Courses.Details.CONTENT_TABLE_NAME, COURSES_ID_DETAILS);
        addURI(StudIP.AUTHORITY, Courses.CONTENT_TABLE_NAME + "/*/" + Courses.Participants.CONTENT_TABLE_NAME, COURSES_ID_PARTICIPANTS);
        addURI(StudIP.AUTHORITY, Mycourses.CONTENT_TABLE_NAME, MYCOURSES);
        addURI(StudIP.AUTHORITY, Schedules.CONTENT_TABLE_NAME, SCHEDULES);
		addURI(StudIP.AUTHORITY, MessagesSent.CONTENT_TABLE_NAME, MESSAGES_SENT);
        addURI(StudIP.AUTHORITY, MessagesSent.CONTENT_TABLE_NAME + "/*", MESSAGES_SENT_ID);
        addURI(StudIP.AUTHORITY, "_all", _ALL);
	}

}
